/*
*	Copyright (C) 2014  Julio Montes, Mario Carrillo
*	
*	Julio Montes e-mail: imc.coder@gmail.com 
*
*	Mario Carrillo e-mail: mario_90ago@live.com.mx
*
*	BSD 3-Clause License
*/

#ifndef IAMAINFRAME_H
#define IAMAINFRAME_H

#include <wx/wxscintilla.h>

#include <wx/wx.h>
#include <wx/aui/aui.h>

///ID's: 1-200
#define iaID_MAIN_FRAME 1


// FILE
#define iaID_FILE_NEW_EMPTY_FILE 11
#define iaID_FILE_OPEN_FILE 14
#define iaID_FILE_SAVE_FILE 15
#define iaID_FILE_SAVE_FILE_AS 16
#define iaID_FILE_SAVE_ALL_FILES 17
#define iaID_FILE_CLOSE_FILE 18
#define iaID_FILE_CLOSE_ALL_FILES 19
#define iaID_FILE_EXIT 20

// EDIT
#define iaID_EDIT_UNDO 31
#define iaID_EDIT_REDO 32
#define iaID_EDIT_CLEAR_HISTORY 33
#define iaID_EDIT_CUT 34
#define iaID_EDIT_COPY 35
#define iaID_EDIT_PASTE 36
#define iaID_EDIT_SELECT_ALL 37
#define iaID_EDIT_AUTOCOMPLETE 39

// VIEW
#define iaID_VIEW_SUB_TOOLBAR 51
#define iaID_VIEW_TOOLBAR_MAIN 52
#define iaID_VIEW_PROJECT 53
#define iaID_VIEW_LOG 54
#define iaID_VIEW_STATUS_BAR 55

// SEARCH
#define iaID_SEARCH_FIND 61
#define iaID_SEARCH_FIND_NEXT 62
#define iaID_SEARCH_FIND_PREV 63
#define iaID_SEARCH_REPLACE 64
#define iaID_SEARCH_GOTO_LINE 65

// SETTINGS
#define iaID_SETTINGS_ENVIRONMENT 101
#define iaID_SETTINGS_EDITOR 102
#define iaID_SETTINGS_PLUGINS 103


//HELP
#define iaID_HELP_ABOUT 111

namespace sdk
{
    class ConfigManager;
}

class iaEditorManager;

class iaMainFrame : public wxFrame
{
public:
    iaMainFrame();
    virtual ~iaMainFrame();

    wxAuiManager *GetAuiManager() const;

    void ResetStatusBar();//HOTFIX: for reset the status bar
protected:
private:
    void OnClose( wxCloseEvent &evt );

    void OnUpdateStyledEditor( wxScintillaEvent &evt );

    void OnPageChanged( wxAuiNotebookEvent &evt );

//    void OnSubNew( wxCommandEvent &evt );
//    void OnSubOpen( wxCommandEvent &evt );
    void OnNewEmptyFile( wxCommandEvent &evt );
    void OnOpenFile( wxCommandEvent &evt );
    void OnSaveFile( wxCommandEvent &evt );
    void OnSaveFileAs( wxCommandEvent &evt );
    void OnSaveAllFiles( wxCommandEvent &evt );
    void OnCloseFile( wxCommandEvent &evt );
    void OnCloseAllFiles( wxCommandEvent &evt );
    void OnExit( wxCommandEvent &evt );
    void OnUpdateFileMenu( wxUpdateUIEvent &evt );


    void OnEditMenu( wxCommandEvent &evt );
    void OnUpdateEditMenu( wxUpdateUIEvent &evt );

    void OnViewMenu( wxCommandEvent &evt );
    void OnUpdateViewMenu( wxUpdateUIEvent &evt );


    void OnFind( wxCommandEvent &evt );
    void OnFindNext( wxCommandEvent &evt );
    void OnFindPrevious( wxCommandEvent &evt );
    void OnReplace( wxCommandEvent &evt );
    void OnGotoLine( wxCommandEvent &evt );
    void OnUpdateSearchMenu( wxUpdateUIEvent &evt );


    void OnSettingsEditor( wxCommandEvent &evt );
    void OnSettingsPlugins( wxCommandEvent &evt );


    void OnHelpAbout( wxCommandEvent &evt );

    bool CloseIDE();
    void SaveIDE();

    wxAuiManager *auiManager;
    wxToolBar *mainToolBar;

    wxStatusBar *sbar;

    iaEditorManager *editorManager;
    wxAuiNotebook *projectManager;
    wxAuiNotebook *logManager;
    sdk::ConfigManager *configManager;

    DECLARE_EVENT_TABLE()
};

#endif // IAMAINFRAME_H
